import request from '@/utils/request'

const path = "/product"
//产品分类树
export function listClassify() {
  return request({
    url: path + '/listClassify',
    method: 'get'
  })
}
// 产品分类树新增
export function addTree(data) {
  return request({
    url: path +'/addClassify',
    method: 'post',
    data: data
  })
}
// 产品树形分类删除
export function delTree(id) {
  return request({
    url: path +"/removeClassify/" + id,
    method: 'delete'
  })
}
// 查询产品列表
export function listProduct(query) {
  return request({
    url: path + '/list',
    method: 'get',
    params: query
  })
}

// 查询产品详细
export function getProduct(id) {
  return request({
    url: path + "/" + id,
    method: 'get'
  })
}

// 新增产品
export function addProduct(data) {
  return request({
    url: path,
    method: 'post',
    data: data
  })
}

// 修改产品
export function updateProduct(data) {
  return request({
    url: path,
    method: 'put',
    data: data
  })
}

// 删除产品
export function delProduct(id) {
  return request({
    url: path + "/" + id,
    method: 'delete'
  })
}
//商品管理
// 分类树
export function listClassify1() {
  return request({
    url: '/commodity/listClassify',
    method: 'get'
  })
}
// 分类树新增
export function addTree1(data) {
  return request({
    url: '/commodity/addClassify',
    method: 'post',
    data: data
  })
}
// 树形分类删除
export function delTree1(id) {
  return request({
    url: "/commodity/removeClassify/" + id,
    method: 'delete'
  })
}
// 查询商品列表
export function listGoods(query) {
  return request({
    url: '/commodity/list',
    method: 'get',
    params: query
  })
}
//商品启用禁用
export function updateGoodsStatus(data) {
  return request({
    url: '/commodity/isStatus',
    method: 'put',
    data: data
  })
}
// 添加商品
export function addGoods(data) {
  return request({
    url: '/commodity',
    method: 'post',
    data: data
  })
}
//商品详情
export function getGoods(id) {
  return request({
    url: "/commodity/" + id,
    method: 'get'
  })
}
//修改商品
export function updateGoods(data) {
  return request({
    url: '/commodity',
    method: 'put',
    data: data
  })
}
// 删除商品
export function delGoods(id) {
  return request({
    url: "/commodity/" + id,
    method: 'delete'
  })
}
//查询商品组{ids}
export function getGoodsGroup(ids,query) {
  return request({
    url: "/commodity/listByIds/" + ids,
    method: 'get',
	params: query
  })
}
//套餐
// 套餐列表
export function listPackage(query) {
  return request({
    url: '/package_main/list',
    method: 'get',
    params: query
  })
}
//套餐详情
export function getPackage(id) {
  return request({
    url: "/package_main/" + id,
    method: 'get'
  })
}
//套餐启用禁用
export function updatePackageStatus(data) {
  return request({
    url: '/package_main/isStatus',
    method: 'put',
    data: data
  })
}
// 添加套餐
export function addPackage(data) {
  return request({
    url: '/package_main',
    method: 'post',
    data: data
  })
}
// 编辑套餐
export function editPackage(data) {
  return request({
    url: '/package_main',
    method: 'put',
    data: data
  })
}
//删除套餐
export function delPackage(id) {
  return request({
    url: "/package_main/" + id,
    method: 'delete'
  })
}
//作物
// 作物列表
export function listCrop(query) {
  return request({
    url: '/crop_variety/list',
    method: 'get',
    params: query
  })
}
//添加
export function addCrop(data) {
  return request({
    url: '/crop_variety',
    method: 'post',
    data: data
  })
}
//获取详情
export function getCrop(id) {
  return request({
    url: "/crop_variety/" + id,
    method: 'get'
  })
}
//编辑作物
export function updateCrop(data) {
  return request({
    url: '/crop_variety',
    method: 'put',
    data: data
  })
}